/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package teste;

import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import modelo.Estado;

/**
 *
 * @author Ronei
 */
public class TesteReflection {
    
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        
        Estado estado = new Estado();
        estado.setId(10L);
        Object obj = estado;
        
        Class clazz = obj.getClass();
        
        Method method = clazz.getMethod("setId",Long.class);
        
       
        
        System.out.println(method.invoke(obj,new Long(100L)));
        System.out.println(estado.getId());
        
    }
    
}
